<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:t="http://myfaces.apache.org/tomahawk"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<ui:composition template="layout/layout.xhtml">
	<ui:define name="content">
		<f:view locale="#{LocalizationController.locale}">
			<h:form ajaxSubmit="true" reRender="utentiList,scrollValidationDown,scroll_1_div">
			
				<h3>Test Session Manager</h3>
				<h4 style="display: inline-block;"><h:outputText value="#{msgs.Session2List}"/></h4>
				<h:commandLink styleClass="btn btn-success pull-right" value="#{msgs.Session8CreateButton}" action="#{SessionManagerController.openCreateSessionView}" />
				
				<t:dataTable id="activeSessionList" var="testSession" styleClass="table table-striped"
					value="#{SessionManagerController.dataModel}" preserveDataModel="false"
					rows="#{SessionManagerController.rowsPerPage}" style="margin-top: 20px;">

					<t:column style="text-transform: uppercase;font-weight: bold;">
						<f:facet name="header">
							<h:outputText value="#{msgs.Session3State}" />
						</f:facet>
						<h:outputText value="#{testSession.state}" />
					</t:column>

					<h:column>
						<f:facet name="header">
							<h:outputText styleClass="headerText" value="#{msgs.Session4Exe}" />
						</f:facet>
						<a4j:commandLink id="openSessionlink" style="margin-left: 10px;" action="#{SessionManagerController.viewSession}"> 
							<i class="icon-play-circle icon-2x"></i>
							<a4j:actionparam name="selectedTestPlanName" value="#{testSession.id}"
								assignTo="#{SessionManagerController.selectedSession}" />
						</a4j:commandLink>
						<rich:toolTip for="openSessionlink" value="#{msgs.Session4Exe2}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Session5SUT}" />
						</f:facet>
						<h:outputText value="#{testSession.sut.name}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Session6TestPlan}" />
						</f:facet>
						 
						<a href="#{testSession.testPlan.publication}" target="_blank"><h:outputText value="#{testSession.testPlan.name}" /></a> 
						
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Session7Report}" />
						</f:facet>
						 
						<a href="#{testSession.report.publication}" target="_blank"><h:outputText value="#{testSession.report.name}" /></a> 
						
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Session15CreationDate}" />
						</f:facet>
						<h:outputText value="#{testSession.creationDateTime}" />
					</h:column>

					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Session16LastUpdateDate}" />
						</f:facet>
						<h:outputText value="#{testSession.lastUpdateDateTime}" />
					</h:column>
					
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{msgs.Common12Delete}" />
						</f:facet>
						<a4j:commandLink ajaxSingle="true" id="trashlink4" oncomplete="#{rich:component('deletePanel')}.show()">
							<i class="icon-trash icon-2x"></i>
							<a4j:actionparam name="idSessionToDelete" value="#{testSession.id}" assignTo="#{SessionManagerController.sessionToDelete}" />
						</a4j:commandLink>
						<rich:toolTip for="trashlink4" value="#{msgs.Common2Cancel}" />
					</h:column>	
					
				</t:dataTable>
				
				<rich:modalPanel id="deletePanel" autosized="true" width="250">
					<f:facet name="header">
						<h:outputText value="#{msgs.Session2472DeleteQuestion}" />
					</f:facet>
					<br />
					<table width="100%">
						<tbody>
							<tr>
								<td align="center" width="20%">
									<i class="icon-warning-sign icon-3x red"></i>
								</td>
								<td align="center" width="40%">
									<a4j:commandLink value="#{msgs.Common12Delete}" styleClass="inputBtn inputBtn-blue"
										oncomplete="#{rich:component('deletePanel')}.hide();return true;"
										action="#{SessionManagerController.deleteSession}" />
								</td>
								<td align="center" width="40%">
									<a4j:commandLink
										value="#{msgs.Common2Cancel}" styleClass="inputBtn inputBtn-grey"
										onclick="#{rich:component('deletePanel')}.hide();return false;" />
								</td>
							</tr>
						</tbody>
					</table>
				</rich:modalPanel>
				
			</h:form>
		</f:view>
	</ui:define>
</ui:composition>
</html>


